package main

import "fmt"

func main() {
	var num1 int
	num1 = 30
	fmt.Printf("%d\n", num1)

	var num2 int = 25
	fmt.Printf("%d\n", num2)

	//推断变量类型
	var name = "lwl"
	fmt.Printf("类型是 %T,值类型为%s\n", name, name)

	//简短定义
	sum := 100
	fmt.Printf("%d\n", sum)

	//多个变量一起定义
	var name1, age, sex = "lwl", 20, "男"
	fmt.Println(name1, sex, age)
	var (
		name2 = "hello"
		age2  = 33
		sex2  = "女"
	)
	fmt.Printf("姓名%s,年龄%d，性别%s\n", name2, age2, sex2)

	//变量与内存地址
	var num_1 int
	num_1 = 100
	fmt.Printf("值：%d,地址%p\n", num_1, &num_1) //值：100,地址0xc000018078

	num_1 = 200
	fmt.Printf("值：%d,地址%p\n", num_1, &num_1) //值：200,地址0xc000018078

}
